package com.example.demo.mapper;

import com.example.demo.entity.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ak
 * @since 2020-04-02
 */
@Mapper
@Repository
public interface CommentMapper extends BaseMapper<Comment> {
    /**
     * 更新评论的二级评论数量
     * @param cId 评论id
     */
    @Update("update comment set c_count = c_count + 1 where c_id = #{cId}")
    void updateCommentCount(Integer cId);

    List<Comment> getCommentAndSecondComment(Integer questionId);
}
